<div class="login">
<?
if(!$USER->isAuth()):?>
    <div class="header">Login or register</div>
<form method="post">
    <? set_action("user_login")?>
    <div class="input">
        <label for="login">Login</label><input type="text" name="login" value=""/>
    </div>
    <div class="input">
        <label for="pass">Pass</label><input type="password" name="pass" value=""/>
    </div>    
    <?
    if (!empty($params['use_captcha'])) {
        print "<div class=\"captcha\">" . Recaptcha::GetHtml() . "</div>";
    }
    ?>
    <div class="input">
        <label for="store">Store</label><input type="checkbox" name="store"/><input type="submit" value="<?= t("Login") ?>"/>
    </div>
</form>
    <div style="text-align: center">
        <a href="/registration/">Singup!</a>&nbsp;|&nbsp;<a href="/restore/">Restore pass</a>
    </div>
<? else: 
    Main::AddHeadScript(pathToUri(__DIR__."/script.js"));
    ?>
    <div class="userinfo">
        <? $info = $USER->GetUserInfo()?>
        <div class="avatar" style="text-align: center"><?
        $ava = Filesystem::GetFile($info['fields']['avatar']['value']);
        if($ava){ print '<img src="'.$ava['uri'].'"/>'; }
        ?></div>
        <div class="username"><?=$info['fields']['name']['value']?></div>
        <div class="balancebar"><?=$info['fields']['balance']['title']?>: <span class="balance"><?=number_format($info['fields']['balance']['value'],2,".","")?></span></div>
        <? Main::Component("system", "menu", array('block_id' => 1, 'section_id' => 7, "use_count" => false), 'user'); ?>
        
    </div>
<form method="post">
    <? set_action("user_logout")?>
        <div class="submit">
        <input type="submit" value="<?= t("Logout") ?>"/>
    </div>
</form>
<? endif ?>
</div>